/*
 * Copyright 2009 Paul Loy
 * 
 * This file is part of java-mod-auth-token-urigen, a library to allow users to
 * create mod_auth_token compatible uris in Java.
 * 
 * java-mod-auth-token-urigen is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * java-mod-auth-token-urigen is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with java-mod-auth-token-urigen.  If not, see <http://www.gnu.org/licenses/>.
 */
 
package com.keteracel.util;

/**
 * @author Paul_Loy (keteracel)
 */
public class StringUtils {
	
	public static String byteToHexString(byte aByte) {
		String hex = Integer.toHexString(0xFF & aByte);
		return ((hex.length() == 1)?"0":"")+hex;
	}

	public static String byteArrayToHexString(byte[] hash) {
		StringBuffer hexString = new StringBuffer();
		for (int i=0;i<hash.length;i++) {
			hexString.append(byteToHexString(hash[i]));
		}
		return hexString.toString();
	}
	
	public static boolean isBlank(String str) {
		return str == null || str.length() == 0;
	}
}
